﻿<%@ Page Title="Thông tin tài khoản" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="profile.aspx.cs" Inherits="MailBox.Profile" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    
<!-- Tab panes -->
    <div class="col-md-12 col-lg-12 col-sm-12 col-xs-12 lefttab">
        <ul class="col-md-12 col-lg-12 col-sm-12 col-xs-12" role="tablist" style="padding:0px;">
          <li class="active" style="padding:0px;width:auto !important;margin-right:10px;float:left;">
              <a class="btn btn-default" href="#thongtintk" role="tab" data-toggle="tab" style="border-radius:0px;">
                  <span class="fa fa-user" style="margin-right:10px;"></span> 
                  <span class="hidden-xs hidden-sm">Thông tin cá nhân</span></a>
            </li>
         <%-- <li style="padding:0px;width:auto !important;margin-right:10px;float:left;">
              <a class="btn btn-default" href="#dacquyen" role="tab" data-toggle="tab" style="border-radius:0px;">
                  <span class="fa fa-star" style="margin-right:10px;"></span>
                  <span class="hidden-xs hidden-sm">Đặt quyền người dùng</span></a>

          </li>
          <li style="padding:0px;width:auto !important;margin-right:10px;float:left;">
              <a class="btn btn-default" href="#sudung" role="tab" data-toggle="tab" style="border-radius:0px;">
                  <span class="fa fa-cogs" style="margin-right:10px;"></span> 
                  <span class="hidden-xs hidden-sm">Thông tin sử dụng</span></a>

          </li>--%>
        </ul>
    </div>
     <script>
         jQuery(function () {
             $("#txtngaysinh").jqxDateTimeInput();
             var url = "Profile.aspx/LoadData";
             $.ajax({
                 type: "POST",
                 url: url,
                 contentType: "application/json; charset=utf-8",
                 dataType: "json",
                 success: function (data) {
                     $("#avatar").attr("src", data.d.Avatar);
                     $("#txtName").val(data.d.AccountName);
                     $("#txtdiachi").val(data.d.Address);
                     $("#txtemail").val(data.d.Email);
                     $("#txtchucvu").val(data.d.DepartmentName);
                     $("#txtcompanyname").val(data.d.TenCongTy);
                     $("#txtngaysinh").jqxDateTimeInput('val',data.d.BirthDay);
                     $("#txtsdt").val(data.d.Phone);
                 },
                 error: function (jqXHR, textStatus, errorThrown) {
                     // Handle errors here
                     console.log('ERRORS: ' + textStatus);
                     alert("Lưu không thành công!");
                     // STOP LOADING SPINNER
                 }
             });
             
             //$("#btnSave").click(function () {
             $(document).on('click', '#btnSave', function (event) {
                 var avatar = $("#avatar").attr("src");
                 var diachi = $("#txtdiachi").val();
                 var ngaysinh = $("#txtngaysinh").jqxDateTimeInput('getText');
                 var phone = $("#txtsdt").val();
                 //alert(ngaysinh);
                 var name = $("#txtName").val();
                 var url = "Profile.aspx/Save";
                 $.ajax({
                     type: "POST",
                     url: url,
                     data: "{avatar:'" + avatar + "', name:'" + name + "', phone:'" + phone+ "', birthday:'" + ngaysinh+ "', address:'" + diachi + "'}",
                     contentType: "application/json; charset=utf-8",
                     dataType: "json",
                     success: function (data) {
                         $("#master-avatar").attr("src", data.d.Avatar);
                         $("#master-avatar2").attr("src", data.d.Avatar);
                         alert('Cap nhat thanh cong.');
                     },
                     error: function (jqXHR, textStatus, errorThrown) {
                         // Handle errors here
                         console.log('ERRORS: ' + textStatus);
                         alert("Lưu không thành công!");
                         // STOP LOADING SPINNER
                     }
                 });
             });
             $(document).on('click', '#btnChangePass', function (event) {
                 var newpass = $("#txtNewPass").val() + '';
                 var Rnewpass = $("#txtReNewPass").val() + '';
                 var currentpass = $("#txtCurrentPass").val() + '';
                 if (currentpass == "") { alert('Bạn chưa nhập mật khẩu hiện tại!'); return; }
                 if (newpass == "") { alert('Bạn chưa nhập mật khẩu mới!'); return; }
                 if (newpass != Rnewpass) { alert('Hai mật khẩu mới không giống!'); return; }
                 if (currentpass == Rnewpass) { alert('Mật khẩu mới không được giống mật khẩu cũ!'); return; }
                 //alert(newpass + '-' + Rnewpass + '-' + currentpass);
                 var url = "Profile.aspx/ChangePass";
                 $.ajax({
                     type: "POST",
                     url: url,
                     data: "{currentpass:'" + currentpass + "', newpass:'" + newpass + "'}",
                     contentType: "application/json; charset=utf-8",
                     dataType: "json",
                     success: function (data) {
                         alert(data.d);
                     },
                     error: function (jqXHR, textStatus, errorThrown) {
                         // Handle errors here
                         console.log('ERRORS: ' + textStatus);
                         alert("Lưu không thành công!");
                         // STOP LOADING SPINNER
                     }
                 });
             });
         });
         </script>
    <div class="tab-content">
      <div class="tab-pane active col-md-12 col-lg-12 col-sm-12 col-xs-12" id="thongtintk" style="padding:0px;">
            <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12" style="padding:0px;"><H3>Thông tin cá nhân</H3></div>
            <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12" style="padding:5px 0px;vertical-align:middle;">
                <div class="col-md-2 col-lg-2 col-sm-3 col-xs-12" style="vertical-align:middle;text-align:center">
                    <div class="col-md-12 col-lg-12 col-sm-12" style="padding:0px;">
                        <img class="img-circle img img-thumbnail" id="avatar" src="images/1386966026professional-man.png" style="width:111px;height:111px;" /> 
                        <input class="hidden" type="file" onChange="readURL(this);" id="avatar_file" />
                    </div>
                    <div class="col-md-12 col-lg-12 col-sm-12" style="padding:10px 0px;">
                        <span class="btn btn-default" style="border-radius:0px;color:#aaa" id="btnSave">Cập nhật</span> 
                    </div>
                </div>
                <div class="col-md-5 col-lg-5 col-sm-4 col-xs-12" style="padding:0px;">
                    <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px 0px;">
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px;font-weight:normal;">Họ và tên</div>
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px;">
                            <input class="input_add" id="txtName" type="text" style="height:34px;line-height:34px;" value="" />
                        </div>
                    </div>
                    <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:3px;">
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px 0px;font-weight:normal;">Tên công ty</div>
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px;">
                            <input class="input_add" type="text" id="txtcompanyname" style="height:34px;line-height:34px;border:0px;" disabled value="" />
                        </div>
                    </div>
                    <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:3px;">
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px 0px;font-weight:normal;">Giới tính</div>
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px;">
                            <input class="input_add" type="text" id="txtgioitinh" style="height:34px;line-height:34px;border:0px;" disabled value="" />
                        </div>
                    </div>
                    <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:3px;">
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px 0px;font-weight:normal;">Địa chỉ liên hệ</div>
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px;">
                            <input class="input_add" type="text" id="txtdiachi" style="height:34px;line-height:34px;" value="" />
                        </div>
                    </div>
                </div>
                <div class="col-md-5 col-lg-5 col-sm-5 col-xs-12" style="padding:0px;">
                    <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px 0px;">
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px;font-weight:normal;">Chức vụ</div>
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px;">
                            <input class="input_add" type="text" id="txtchucvu" style="height:34px;line-height:34px;" disabled value="" />
                        </div>
                    </div>
                    <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:3px;">
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px 0px;font-weight:normal;">Số điện thoại</div>
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px;">
                            <input class="input_add" type="text" id="txtsdt" style="height:34px;line-height:34px;" value="" />
                        </div>
                    </div>
                    <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:3px;">
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px 0px;font-weight:normal;">Ngày sinh</div>
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px;">
                            <div id="txtngaysinh" style="width:auto;height:34px;line-height:34px;" value="" />
                        </div>
                    </div>
                    <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:3px;">
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px 0px;font-weight:normal;">Email đăng ký</div>
                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:5px;">
                            <input class="input_add" id="txtemail" disabled style="height:34px;line-height:34px;border:0px;" value="" />
                        </div>
                    </div>
                
                </div>
            </div>
            <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:0px;">
                <div class="panel-group" id="accordion">
                    <div class="panel panel-default col-md-12 col-xs-12 col-sm-12 col-lg-12" style="border-radius:0px;padding:0px;">
                        <div class="panel-heading col-md-12 col-xs-12 col-sm-12 col-lg-12" style="background:#fff;color:#aaa;padding:10px;">
                            <h4 class="panel-title">
                                Đổi mật khẩu
                            </h4>
                        </div>
                        <div id="change_pass" class="panel-collapse collapse in col-xs-12 col-xs-12 col-sm-12 col-lg-12" style="padding:0px;">
                            <div class="panel-body col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding: 0px;">
                                <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding: 10px 0px; vertical-align: middle;">
                                    <div class="col-md-3 col-lg-3 col-sm-6 col-xs-12" style="padding: 10px;">
                                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding: 0px;">
                                            <input id="txtCurrentPass" class="input_add" type="password" style="font-weight: normal;" placeholder="Mật khẩu hiện tại" />
                                        </div>
                                    </div>
                                    <div class="col-md-3 col-lg-3 col-sm-6 col-xs-12" style="padding: 10px;">
                                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding: 0px;">
                                            <input id="txtNewPass" class="input_add" type="password" style="font-weight: normal;" placeholder="Mật khẩu mới" />
                                        </div>
                                    </div>
                                    <div class="col-md-3 col-lg-3 col-sm-6 col-xs-12" style="padding: 10px;">
                                        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding: 0px;">
                                            <input class="input_add" id="txtReNewPass" type="password" style="font-weight: normal;" placeholder="Xác nhận mật khẩu" />
                                        </div>
                                    </div>
                                    <div class="col-md-3 col-lg-3 col-sm-6 col-xs-12" style="padding: 10px;">
                                        <div class="col-md-12 col-lg-12 col-sm-12" style="padding:2px 0px;">
                                            <span class="btn btn-default" style="border-radius: 0px; color: #fff;background:#d00;" id="btnChangePass">Cập nhật</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div> 
      </div>
     <%-- <div class="tab-pane col-md-12 col-xs-12 col-sm-12 col-lg-12" id="dacquyen" style="padding:0px;">
        <H3>Các tính năng</H3>
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:0px;">
            <div class="col-md-4 col-lg-4 col-sm-4 col-xs-12" style="padding:5px;">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding:5px;border:1px solid #ddd;text-align:center;">Gửi Autoresponder</div>
            </div>
            <div class="col-md-4 col-lg-4 col-sm-4 col-xs-12" style="padding:5px;">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding:5px;border:1px solid #ddd;text-align:center;">Gửi Broadcast</div>
            </div>
            <div class="col-md-4 col-lg-4 col-sm-4 col-xs-12" style="padding:5px;">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding:5px;border:1px solid #ddd;text-align:center;">MailBox</div>
            </div>
            <div class="col-md-4 col-lg-4 col-sm-4 col-xs-12" style="padding:5px;">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding:5px;border:1px solid #ddd;text-align:center;">Quét tiêu chuẩn HTML</div>
            </div>
            <div class="col-md-4 col-lg-4 col-sm-4 col-xs-12" style="padding:5px;">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding:5px;border:1px solid #ddd;text-align:center;">Theo dõi, thống kê</div>
            </div>
        </div>
      </div>
      <div class="tab-pane col-md-12 col-xs-12" id="sudung" style="padding:0px;">
        <div class="col-md-12 col-xs-12" style="padding:0px;"><H3>Thông tin sử dụng</H3></div>
          <div class="col-md-12 col-xs-12" style="padding:5px;">
              <div class="col-md-4 col-xs-12">
                  Số mail đã sử dụng :
                  <span class="pull-right">1200/3000</span>
              </div>
              <div class="col-md-6 col-xs-12" style="padding:5px;">
                  <div class="col-md-12 col-xs-12">
                      <div style="width:40%;background:#0d0;height:10px;color:#ccc;float:left;"></div>
                      <div style="width:60%;background:#ddd;height:10px;color:#ccc;float:left;"></div>
                  </div>
              </div>
              <div class="col-md-2 col-xs-12" style="padding:5px;font-weight:normal;">
                  Đây là gì ?
              </div>

          </div>
          <div class="col-md-12 col-xs-12" style="padding:5px;">
              <div class="col-md-4 col-xs-12">
                  Số tài nghuyên đã sử dụng :
                  <span class="pull-right">1 Gb/ 10 Gb</span>
              </div>
              <div class="col-md-6 col-xs-12" style="padding:5px;">
                  <div class="col-md-12 col-xs-12">
                      <div style="width:10%;background:#00d;height:10px;color:#ccc;float:left;"></div>
                      <div style="width:90%;background:#ddd;height:10px;color:#ccc;float:left;"></div>
                  </div>
              </div>
              <div class="col-md-2 col-xs-12" style="padding:5px;font-weight:normal;">
                  Đây là gì ?
              </div>
          </div>
          <div class="col-md-12 col-xs-12" style="padding:5px;">
              <div class="col-md-4 col-xs-12">
                  Số tài khoản đã tạo :
                  <span class="pull-right">6 User / 10 User</span>
              </div>
              <div class="col-md-6 col-xs-12" style="padding:5px;">
                  <div class="col-md-12 col-xs-12">
                      <div style="width:60%;background:#fa0;height:10px;color:#ccc;float:left;"></div>
                      <div style="width:40%;background:#ddd;height:10px;color:#ccc;float:left;"></div>
                  </div>
              </div>
              <div class="col-md-2 col-xs-12" style="padding:5px;font-weight:normal;">
                  Đây là gì ?
              </div>
          </div>
          <div class="col-md-12 col-xs-12" style="padding:5px;">
              <div class="col-md-4 col-xs-12">
                  Thời gian sử dụng dịch vụ :
                  <span class="pull-right">300 Days / 360 Days</span>
              </div>
              <div class="col-md-6 col-xs-12" style="padding:5px;">
                  <div class="col-md-12 col-xs-12">
                      <div style="width:85%;background:#d00;height:10px;color:#ccc;float:left;"></div>
                      <div style="width:15%;background:#ddd;height:10px;color:#ccc;float:left;"></div>
                  </div>
              </div>
              <div class="col-md-2 col-xs-12" style="padding:5px;font-weight:normal;">
                  Đây là gì ?
              </div>
          </div>
          <div class="col-md-12 col-xs-12" style="padding:15px;font-weight:normal;">
              Khi đạt mức cảnh báo thì bạn hãy nên <b>gia hạn</b> hoặc muốn <b>năng cấp</b> gói dịch vụ của mình để công việc của bạn và công ty không bị gián đoạn.<br/> Cảm ơn
          </div>
      </div>--%>
    </div>
</asp:Content>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="SmartPhoneLeft">
    <div class="col-xs-12" style="width:100%;padding: 5px 0px; text-align: center;">
        <div class="col-xs-12" style="padding: 5px 0px; text-align: center;">
            
            <div class="col-xs-3" style="padding:5px;text-align:right;">
                <img class="img-circle img img-thumbnail dropdown-toggle" data-toggle="dropdown" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpf1/t1.0-1/c6.0.160.160/p160x160/10450596_545002008956679_2387905694320684413_n.jpg" style="width: 100%;" />
                <div class="dropdown-menu" style="width: 300px; left: 0px !important; padding: 10px;">
                    <div class="col-xs-12" style="padding: 0px;">
                        <div class="col-xs-4" style="padding: 0px;">
                            <img class="img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpf1/t1.0-1/c6.0.160.160/p160x160/10450596_545002008956679_2387905694320684413_n.jpg" style="width: 100%;" />
                        </div>
                        <div class="col-xs-8" style="padding: 4px 20px;">
                            <p style="font-size: 16px;">
                                <b style="font-size: 14px;">Yas Jek</b><br />
                                yas.jek@gmail.com
                            </p>
                            <p style="margin: 0px;">
                                <span class="btn btn-default" style="width: 100%; height: 34px; border-radius: 0px;" onclick="window.open('Profile.aspx','_self');">Thông tin</span>
                            </p>
                        </div>
                    </div>
                    <div class="col-xs-12" style="padding: 0px;">
                        <div class="col-xs-6" style="padding: 7px 5px 0px 0px; line-height: 34px;">
                            <span class="btn btn-default" style="width: 100%; height: 34px; border-radius: 0px;" onclick="window.open('Setting.aspx','_self');">Cài đặt</span>
                        </div>
                        <div class="col-xs-6" style="padding: 7px 0px 0px 5px; line-height: 34px;">
                            <span class="btn btn-default" style="width: 100%; height: 34px; border-radius: 0px;" onclick="window.open('Logout.aspx','_self');">Đăng xuất</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-7" style="padding:5px;">
                <div class="col-xs-12" style="padding:0px;font-weight:bold;text-align:center;">
                    <span class="visible-xs noprint" style="line-height:26px;color:#555;">bthehien@gmail.com</span>
                </div>
            </div>
            <div class="col-xs-2" style="padding:0px;">
                    <span class="menu-anchor visible-xs pull-right noprint" style="border: 1px solid #ddd; margin: 10px;"></span>
            </div>
        </div>
    </div>
    <hr />
    <div class="col-xs-12 menu_left" style="padding: 0px;">
        <ul>
            <li class="active"><a href="default.aspx">Hộp thư đến (2)</a></li>
            <li><a href="#">Thư đã gửi</a></li>
            <li><a href="#">Hộp thư Spam</a></li>
            <li><a href="#">Thư nháp</a></li>
            <li><a href="#">Thùng rác</a></li>
        </ul>
    </div>
</asp:Content>